<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: install_step_0.php 458 2014-01-30 15:03:23Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 458 $
* 	zuletzt geaendert von:	$Author: peter $
* 	Datum:					$Date: 2014-01-30 15:03:23 +0000 (Thu, 30 Jan 2014) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

if(!defined('VALID_INSTALLER'))
	header('Location: ../../');

define('HTTP_SERVER', '');
define('HTTPS_SERVER', '');
define('DIR_WS_CATALOG', '');

$process = false;
if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
	$process = true;
	$_SESSION['language'] = $_POST['LANGUAGE'];
	$error = false;
	if (($_SESSION['language'] != 'german') && ($_SESSION['language'] != 'english')) {
		$error = true;
		$message_stack->add('index', SELECT_LANGUAGE_ERROR);
	}
	
	if ($error == false && $process)
		redirect(href_link('index.php', 'step=1', 'NONSSL'));
}

function get_php_setting($val) {
	$r = (ini_get($val) == '1' ? 1 : 0);
	return $r ? 'An' : 'Aus';
}

$files_to_check = array(DIR_FS_CATALOG.'includes/configure.php',
						DIR_FS_CATALOG.'admin/includes/configure.php',
						DIR_FS_CATALOG.'export/google_taxonomy.txt'
						);

$folder_to_check = array(DIR_FS_CATALOG.'admin/backups',
						DIR_FS_CATALOG.'admin/cache',
						DIR_FS_CATALOG.'admin/rechnungen',
						DIR_FS_CATALOG.'admin/images/graphs',
						DIR_FS_CATALOG.'admin/templates_c',
						DIR_FS_CATALOG.'cache',
						DIR_FS_CATALOG.'download',
						DIR_FS_CATALOG.'export',
						DIR_FS_CATALOG.'import',
						DIR_FS_CATALOG.'images',
						DIR_FS_CATALOG.'images/categories',
						DIR_FS_CATALOG.'images/categories_org',
						DIR_FS_CATALOG.'images/content',
						DIR_FS_CATALOG.'images/banner',
						DIR_FS_CATALOG.'images/brand',
						DIR_FS_CATALOG.'images/products_movies',
						DIR_FS_CATALOG.'images/product_options',
						DIR_FS_CATALOG.'images/product_images/icon_images',
						DIR_FS_CATALOG.'images/product_images/info_images',
						DIR_FS_CATALOG.'images/product_images/original_images',
						DIR_FS_CATALOG.'images/product_images/popup_images',
						DIR_FS_CATALOG.'images/product_images/thumbnail_images',
						DIR_FS_CATALOG.'images/slider',
						DIR_FS_CATALOG.'images/slider/slider_org',
						DIR_FS_CATALOG.'images/slider/slider_big',
						DIR_FS_CATALOG.'images/slider/slider_thumb',
						DIR_FS_CATALOG.'media',
						DIR_FS_CATALOG.'media/content',
						DIR_FS_CATALOG.'media/files',
						DIR_FS_CATALOG.'media/flash',
						DIR_FS_CATALOG.'media/products',
						DIR_FS_CATALOG.'pub',
						DIR_FS_CATALOG.'templates_c');
						
include('includes/metatag.php');
?>
<title>SEO:mercari Installation - Willkommen</title>
<link rel="stylesheet" type="text/css" href="includes/javascript/cluetip/jquery.cluetip.css" />
<script src="includes/javascript/cluetip/jquery.cluetip.js" type="text/javascript"></script>
<script type="text/javascript">
	<!--
	$(function() {
		$('a.help_tip').cluetip({width:500,sticky:true,activation:'click',closePosition:'title',closeText:'schliessen [x]'});
		$("#cluetip").draggable();
	});
	//-->
</script>
</head>
<body>
<?php include('includes/header.php'); ?>
		<div id="wrapper">
			<div id="inner_wrapper">
				<table class="outerTable" width="100%" cellpadding="4">
					<tr>
						<td class="columnRight" valign="top">
							<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td class="pageHeading">
										<h1 class="schatten">Willkommen zur <?php echo PROJECT_VERSION.PROJECT_VERSION_TYPE; ?> Installation</h1>
									</td>
								</tr>
							</table>
							<table border="0" width="100%" cellspacing="0" cellpadding="0">
								<tr>
									<td>
										<?php echo TEXT_WELCOME_INDEX; ?><br /><hr /><br />
										<?php
										$error_folder_flag = false;
										$error_file_flag = false;
										$error_flag = false;
										$php_flag == false;
										$gdlib_flag == false;
										$error_message = '';
										$ok_message = '';
										$infos = '';

										$file_message = '';
										foreach ($files_to_check AS $files) {
											@chmod($files, 0777);
											if (!is_writeable($files)) {
												$error_file_flag = true;
												$file_message .= $files.'<br />';
											}
										}

										$folder_message = '';
										foreach ($folder_to_check AS $folders) {
											@chmod($folders, 0777);
											if (!is_writeable($folders)) {
												$error_folder_flag = true;
												$folder_message .= $folders.'<br />';
											}
										}

										// check PHP-Version
										if (check_version() != 1) {
											$error_flag = true;
											$error_message .= '<strong>Achtung!, Ihre PHP Version ist zu alt, SEO:mercari ben&ouml;tigt mindestens PHP 5.1.0.</strong><br /><br />Ihre PHP Version: <b>'.phpversion().'</b><br /><br />SEO:mercari wird auf diesem Server nicht laufen. Updaten Sie Ihr PHP oder wechseln Sie den Server.<br/> Gerne bieten wir Ihnen eine <a href="http://www.siekiera-media.de/webhosting.html">kosteng&uuml;nstige Alternative</a>, passend für SEO:mercari an.';
										} else {
											$php_version = phpversion();
											$ok_message .= 'PHP Version - <strong>'.$php_version.'</strong><br />';
										}

										// Prüfen der GDLib Version
										$gd = gd_info();
										if ($gd['GD Version'] == '') {
											$error_flag = true;
											$error_message .= '<br /><strong>Fehler keine GDlib gefunden!</strong><br /><br />Sie haben keine Unterst&uuml;tzung f&uuml;r GIF Grafiken';
										} else {
											$ok_message .= 'GDlib Version - <strong>'.$gd['GD Version'].'</strong><br />';
										}
										if ($gd['GIF Create Support'] == 1) // GIF
											$infos .= '<tr><td width="40%">GIF Erstellung</td> <td><span style="color:#4eb56c">Ja</span></td></tr>';
										else
											$infos .= '<tr><td width="40%">GIF Erstellung</td> <td><span style="color:#b20000">Nein</span></td></tr>';

										if ($gd['JPG Support'] == 1 || $gd['JPEG Support'] == 1)
											$infos .= '<tr><td>JPG Erstellung</td> <td><span style="color:#4eb56c">Ja</span></td></tr>';
										else
											$infos .= '<tr><td>JPG Erstellung</td> <td><span style="color:#b20000">Nein</span></td></tr>';
										if ($gd['PNG Support'] == 1)
											$infos .= '<tr><td>PNG Erstellung</td> <td><span style="color:#4eb56c">Ja</span></td></tr>';
										else
											$infos .= '<tr><td>PNG Erstellung</td> <td><span style="color:#b20000">Nein</span></td></tr>';

										$infos .= '<tr><td>MySQL Version</td> <td>'.mysql_get_client_info().'</td></tr>';
										$infos .= '<tr><td>Webserver</td><td>'.$_SERVER['SERVER_SOFTWARE'].'</td></tr>';
										$infos .= '<tr><td><nobr>PHP-Anbindung zum Webserver&nbsp;</nobr></td> <td>'.php_sapi_name().'</td></tr>';
										$infos .= '<tr><td>Safe Mode</td> <td>'.get_php_setting('safe_mode').'</td></tr>';
										$infos .= '<tr><td>Fehler Ausgabe</td> <td>'.get_php_setting('display_errors').'</td></tr>';
										$infos .= '<tr><td>Kurze Open-Tags</td> <td>'.get_php_setting('short_open_tag').'</td></tr>';
										$infos .= '<tr><td>Datei-Uploads</td> <td>'.get_php_setting('file_uploads').'</td></tr>';
										$infos .= '<tr><td>Magic-Quotes</td> <td>'.get_php_setting('magic_quotes_gpc').'</td></tr>';
										$infos .= '<tr><td>Register-Globals</td> <td>'.get_php_setting('register_globals').'</td></tr>';
										$infos .= '<tr><td>Session Speicherpfad</td> <td>'.ini_get('session.save_path').'</td></tr>';

										if ($gd['GIF Read Support'] == 1 || $gd['GIF Create Support'] == 1)
											$ok_message .= 'GDlib Create-Support - <strong>Ja</strong> - Overlay f&uuml;r Grafiken wird unterst&uuml;tzt.<br />';
										else
											$error_message .= 'Sie haben keinen GDlib Support, die Overlay Funktion f&uuml;r die Kategorie- und Produktbilder wird nicht unterst&uuml;tzt!';

										// Falsche - Richtige Dateirechte
										if ($error_file_flag == true) {
											echo '<fieldset class="installer red border_radius_4"><legend><strong><span style="color:#b20000">'.ATTENTION.'</span> - '.WRONG_FILE_PERMISSION.'</strong> '.get_help('4', 'Ordnerrechte').'</legend>';
											echo '<p>Dieses Script hat versucht die richtigen Datei-Rechte zu setzen, aber anscheinend ist der Ausführende User auf diesem Server dazu nicht berechtigt. Prüfen Sie das mit Hilfe eines geeineten FTP - Programms.<p>';
											echo $file_message;
											echo '</fieldset>';
										} else {
											echo '<fieldset class="installer green  border_radius_4"><legend><strong><span style="color:#4eb56c">OK</span></strong></legend>';
											echo CORRECT_FILE_PERMISSION;
											echo '</fieldset>';
										}
										// Falsche - Richtige Verzeichnisrechte
										if ($error_folder_flag == true) {
											echo '<fieldset class="installer red border_radius_4"><legend>'.WRONG_FOLDER_PEMISSION.' '.get_help('84', '', 'Installationshilfe').'</legend>';
											echo '<p>Dieses Script hat versucht die richtigen Ordner-Rechte zu setzen, aber anscheinend ist der Ausführende User auf diesem Server dazu nicht berechtigt. Prüfen Sie das mit Hilfe eines geeineten FTP - Programms.<p>';
											echo $folder_message;
											echo '</fieldset>';
										} else {
											echo '<fieldset class="installer green border_radius_4"><legend><strong><span style="color:#4eb56c">OK</span></strong></legend>';
											echo CORRECT_FOLDER_PERMISSION;
											echo '</fieldset>';
										}

										if ($error_flag == true) {
											echo '<fieldset class="installer red border_radius_4"><legend><strong><span style="color:#b20000">'.ATTENTION.'</span></strong></legend>';
											echo $error_message;
											echo '</fieldset>';
										} else {
											echo '<fieldset class="installer green border_radius_4"><legend><strong><span style="color:#4eb56c">OK</span></strong></legend>';
											echo $ok_message;
											echo '</fieldset>';
										}
										if ($infos != '') {
											echo '<fieldset class="installer border_radius_4"><legend><strong>'.SERVER_INFO.'</strong></legend>';
											echo '<table width="100%">'.$infos.'</table>';
											echo '</fieldset>';
										}
										?>
										<form name="language" method="post" action="index.php?step=0&action=process">
											<table width="100%" cellpadding="8" cellspacing="8">
												<tr>
													<td align="right" valign="middle">
														<?php if ($error == false && $error_folder_flag == false && $error_file_flag == false && $error_flag == false) { ?>
															<input type="hidden" name="LANGUAGE" value="german" />
															<input type="submit" class="button" value="Installation fortsetzen" /><input type="hidden" name="action" value="process" />
														<?php } else { ?>
															<a href="index.php" class="button">Pr&uuml;fung wiederholen</a>
														<?php } ?>
													</td>
												</tr>
											</table>
										</form>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<?php
			include('includes/footer.php');
		?>
	</body>
</html>